<template>
  <div>
    <!-- 头部部分 -->
    <header class="header">
      <h1>todos</h1>
      <input
        @keyup.enter="add"
        v-model="todoName"
        class="new-todo"
        placeholder="请输入任务名称"
        autofocus
      />
    </header>
  </div>
</template>
 
<script>
export default {
  name: "Header",
  data() {
    return {
      todoName: "",
    };
  },
  methods: {
    add() {
      this.$emit('add',this.todoName)
      this.todoName=''
    },
  },
};
</script>

<style scoped>
</style>